Skip to content

Next steps for FnDef binder changes (instantiate most FnDef binders) - #159403

Open
addiesh wants to merge 1 commit into
rust-lang:mainfrom
addiesh:call-me-turbofishmael
Open

Next steps for FnDef binder changes (instantiate most FnDef binders)#159403
addiesh wants to merge 1 commit into
rust-lang:mainfrom
addiesh:call-me-turbofishmael

Conversation

@addiesh

@addiesh addiesh commented Jul 16, 2026

Copy link
Copy Markdown

View all comments

This change is a part of the ongoing effort to clean up binder/turbofishing behavior in the compiler (#156581).

This PR instantiates binders that were previously created via ty::Binder::dummy() with meaningfully bound vars.

r? oli-obk

Call me Turbofishmael.
Some years ago- never mind how long precisely-
having little or no money in my purse,
and nothing particular to interest me in C++,
I thought I would sail about a little and see the rusty part of the world.

@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. PG-exploit-mitigations Project group: Exploit mitigations S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Jul 16, 2026
@rustbot

rustbot commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the pull request, and welcome! The Rust Project is excited to review your changes, and you should hear from @oli-obk (or someone else) some time within the next two weeks.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@addiesh
addiesh force-pushed the call-me-turbofishmael branch 3 times, most recently from 014b214 to d780036 Compare July 16, 2026 19:40
@rust-log-analyzer

This comment has been minimized.

@addiesh

This comment was marked as resolved.

@addiesh
addiesh force-pushed the call-me-turbofishmael branch from d780036 to 6e740ba Compare July 16, 2026 20:10
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@addiesh
addiesh force-pushed the call-me-turbofishmael branch from 330681e to 83e428c Compare July 17, 2026 15:14
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@addiesh
addiesh force-pushed the call-me-turbofishmael branch from 9fb9767 to 3920a9e Compare July 17, 2026 22:34
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@addiesh
addiesh force-pushed the call-me-turbofishmael branch from 5373d53 to f118249 Compare July 20, 2026 15:15
@rust-log-analyzer

This comment has been minimized.

@addiesh
addiesh force-pushed the call-me-turbofishmael branch from f118249 to 6aeb29e Compare July 20, 2026 15:28
@rust-log-analyzer

This comment has been minimized.

@addiesh
addiesh force-pushed the call-me-turbofishmael branch from 6aeb29e to ac8e8e5 Compare July 20, 2026 15:33
@addiesh
addiesh marked this pull request as ready for review July 20, 2026 15:48
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jul 28, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jul 28, 2026
Next steps for FnDef binder changes (instantiate most FnDef binders)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 28, 2026
Replace most `Ty::new_fn_def` calls with `type_of` queries directly

This is so we can reduce the amount of code and changes in rust-lang#159403. It should stand on its own, but really it's meant as an extended part of 159403.

This allows getting the right `ty::FnDef` even cross-crate, as the `type_of` query results are stored in metadata, in contrast to the queries for computing the binder for various declarations. These binders are already cached via `fn_sig`, but using that is somewhat overkill and can cause cycle errors in some cases.
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 28, 2026
Replace most `Ty::new_fn_def` calls with `type_of` queries directly

This is so we can reduce the amount of code and changes in rust-lang#159403. It should stand on its own, but really it's meant as an extended part of 159403.

This allows getting the right `ty::FnDef` even cross-crate, as the `type_of` query results are stored in metadata, in contrast to the queries for computing the binder for various declarations. These binders are already cached via `fn_sig`, but using that is somewhat overkill and can cause cycle errors in some cases.
@rust-bors

rust-bors Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: e543d43 (e543d43122dcbf198ae8b3f808a8c2bf1593e979)
Base parent: e19d321 (e19d321c06479c6fd77533582b0d5a86651f1be3)

@rust-timer

This comment has been minimized.

JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 28, 2026
Replace most `Ty::new_fn_def` calls with `type_of` queries directly

This is so we can reduce the amount of code and changes in rust-lang#159403. It should stand on its own, but really it's meant as an extended part of 159403.

This allows getting the right `ty::FnDef` even cross-crate, as the `type_of` query results are stored in metadata, in contrast to the queries for computing the binder for various declarations. These binders are already cached via `fn_sig`, but using that is somewhat overkill and can cause cycle errors in some cases.
@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (e543d43): comparison URL.

Overall result: ❌✅ regressions and improvements - please read:

Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf.

Next, please: If you can, justify the regressions found in this try perf run in writing along with @rustbot label: +perf-regression-triaged. If not, fix the regressions and do another perf run. Neutral or positive results will clear the label automatically.

@bors rollup=never rustc-perf
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
0.3% [0.2%, 0.4%] 18
Regressions ❌
(secondary)
0.3% [0.1%, 0.5%] 10
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.5% [-0.9%, -0.1%] 3
All ❌✅ (primary) 0.3% [0.2%, 0.4%] 18

Max RSS (memory usage)

Results (primary 1.0%, secondary 1.6%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
1.0% [0.8%, 1.7%] 5
Regressions ❌
(secondary)
3.4% [2.3%, 4.5%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.0% [-2.0%, -2.0%] 1
All ❌✅ (primary) 1.0% [0.8%, 1.7%] 5

Cycles

Results (primary -1.3%, secondary -3.1%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
4.0% [4.0%, 4.0%] 1
Improvements ✅
(primary)
-1.3% [-1.3%, -1.3%] 1
Improvements ✅
(secondary)
-4.5% [-6.1%, -3.1%] 5
All ❌✅ (primary) -1.3% [-1.3%, -1.3%] 1

Binary size

Results (primary 0.2%, secondary 0.3%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
0.2% [0.0%, 0.5%] 83
Regressions ❌
(secondary)
0.3% [0.0%, 1.0%] 56
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.2% [0.0%, 0.5%] 83

Bootstrap: 490.165s -> 490.514s (0.07%)
Artifact size: 388.34 MiB -> 391.03 MiB (0.69%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jul 28, 2026
rust-timer added a commit that referenced this pull request Jul 28, 2026
Rollup merge of #159665 - addiesh:turbofish-fear-me, r=oli-obk

Replace most `Ty::new_fn_def` calls with `type_of` queries directly

This is so we can reduce the amount of code and changes in #159403. It should stand on its own, but really it's meant as an extended part of 159403.

This allows getting the right `ty::FnDef` even cross-crate, as the `type_of` query results are stored in metadata, in contrast to the queries for computing the binder for various declarations. These binders are already cached via `fn_sig`, but using that is somewhat overkill and can cause cycle errors in some cases.
@rust-bors

This comment has been minimized.

@rustbot

rustbot commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred to the core trait solver

cc @rust-lang/initiative-trait-system-refactor

Some changes occurred in compiler/rustc_passes/src/check_attr.rs

cc @jdonszelmann, @JonathanBrouwer

rustc-dev-guide is developed in its own repository. If possible, consider making this change to rust-lang/rustc-dev-guide instead.

cc @BoxyUwU, @tshepang

Some changes occurred in coverage instrumentation.

cc @Zalathar

Some changes occurred in compiler/rustc_attr_parsing

cc @jdonszelmann, @JonathanBrouwer

These commits modify the Cargo.lock file. Unintentional changes to Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

miri is developed in its own repository. If the Miri part of this change can be broken out, consider making this change to rust-lang/miri instead. However, if Miri needs adjusting for rustc changes, just ignore this message.

cc @rust-lang/miri

Some changes occurred to the CTFE / Miri interpreter

cc @rust-lang/miri

This PR changes rustc_public

cc @oli-obk, @celinval, @ouz-a, @makai410

Some changes occurred to the CTFE machinery

cc @RalfJung, @oli-obk, @lcnr

The parser was modified, potentially altering the grammar of (stable) Rust
which would be a breaking change.

cc @fmease

rustc_codegen_gcc is developed in its own repository. If possible, consider making this change to rust-lang/rustc_codegen_gcc instead.

cc @antoyo, @GuillaumeGomez

Some changes occurred in GUI tests.

cc @GuillaumeGomez

Some changes occurred to diagnostic attributes.

cc @mejrs

changes to the core type system

cc @lcnr

This PR modifies bootstrap.example.toml.

If appropriate, please update CONFIG_CHANGE_HISTORY in src/bootstrap/src/utils/change_tracker.rs.

Some changes occurred in const_evaluatable.rs

cc @BoxyUwU

Some changes occurred in compiler/rustc_hir/src/attrs

cc @jdonszelmann, @JonathanBrouwer

@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) A-CI Area: Our Github Actions CI A-meta Area: Issues & PRs about the rust-lang/rust repository itself A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) A-run-make Area: port run-make Makefiles to rmake.rs A-rustc-dev-guide Area: rustc-dev-guide A-testsuite Area: The testsuite used to check the correctness of rustc O-unix Operating system: Unix-like T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. labels Jul 29, 2026
@addiesh
addiesh force-pushed the call-me-turbofishmael branch from 1047fdb to d8350cc Compare July 29, 2026 14:33
@rustbot

rustbot commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@addiesh

This comment was marked as resolved.

@addiesh addiesh Jul 20, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this """"fixed"""" issue #133613, but the errors are absolutely nasty and it uses experimental features. This is worth checking out.

View changes since the review

@addiesh
addiesh force-pushed the call-me-turbofishmael branch from d8350cc to 85d2121 Compare July 29, 2026 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) A-CI Area: Our Github Actions CI A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-meta Area: Issues & PRs about the rust-lang/rust repository itself A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) A-run-make Area: port run-make Makefiles to rmake.rs A-rustc-dev-guide Area: rustc-dev-guide A-testsuite Area: The testsuite used to check the correctness of rustc O-unix Operating system: Unix-like perf-regression Performance regression. PG-exploit-mitigations Project group: Exploit mitigations S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants